#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1e5 + 10;
int arr[N];
int n, w;
int cmp(int a, int b)
{
	return a > b;
}
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n >> w;
		for (int i = 0; i < n; i++)cin >> arr[i];
		int cnt = 0;
		sort(arr, arr + n, cmp);
		int ans = 0;
		for (int i = 0; i < n; i++) {
			if (ans + arr[i] <= w) {
				cnt++;
				ans += arr[i];
				//cout << "ans==" << ans << endl;
			}
			else {
				cnt++;
				break;
			}
		}
		cout << cnt << endl;
	}
	return 0;
}